home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games Extra 1996 September
/
Amiga Games Extra CD-ROM 9-1996.iso
/
userbox
/
demoversionen
/
dcf77 demo v3 beta
/
für programmierer
/
waitfordcf77.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-13
|
1KB
|
55 lines
/* WaitForDCF77 ***RGR***
12-sep-94
Author: Ralf Gruner, An der Sense 5a, D-02779 Großschönau, Germany.
*/
#include <exec/types.h>
#include <exec/semaphores.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
struct StatusList
{
struct SignalSemaphore sl_Semaphore;
STRPTR version;
BOOL Received;
};
struct StatusList *DCF77PublicStatus=NULL;
UBYTE * DCF77SemaphoreName = "DCF77 State";
BOOL DCF77received=FALSE;
main(int argc, char *argv[])
{
char *msg1="\n WaitForDCF77 Version 1.01 - © 1994 Ralf Gruner, Großschönau, Germany.\n";
char *msg2=" WaitForDCF77 waits for received time from the\n european radio clock signal DCF77.";
char *msg3=" Usage: Simply run it while the receiver software DCF77 is running.\n";
if(argc != 1)
{
puts(msg1);
puts(msg2);
puts(msg3);
}
else
while(!DCF77received)
{
Forbid();
if(DCF77PublicStatus=(struct StatusList *) FindSemaphore(DCF77SemaphoreName))
{
ObtainSemaphoreShared((struct SignalSemaphore *) DCF77PublicStatus);
DCF77received=DCF77PublicStatus->Received;
ReleaseSemaphore((struct SignalSemaphore *) DCF77PublicStatus);
}
else
DCF77received=FALSE; // DCF77 is not running
Permit();
if(!DCF77received)
Delay(150L); // wait three seconds and try again...
}
}